package com.studycloud.service;

import com.studyclud.entity.Payment;
import com.studyclud.result.CommonResult;
import feign.Param;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import static com.studyclud.constant.ConstantUrl.PAYMENT_URL;

/**
 * @author JP
 */
@Component
@FeignClient(value =PAYMENT_URL)
public interface PaymentFeignService
{
    /**
     *
     * @param payment
     * @return
     */
    @PostMapping(value = "/payment/create")
    CommonResult<Integer> create(@RequestBody Payment payment);


    /**
     *
     * @param id
     * @return
     */
    @GetMapping(value = "/payment/getPaymenById/{id}")
    CommonResult<Payment> getPaymenById(@PathVariable("id")Long id);

    /**
     *
     * @return
     */
    @GetMapping(value = "/payment/feign/timeout")
    public String paymentFeignTimeout();

}
